CREATE PROCEDURE [dbo].[ProviderClinicTypeGet]
	@Id				UNIQUEIDENTIFIER,
	@ProviderId		UNIQUEIDENTIFIER,
	@ClinicTypeId	UNIQUEIDENTIFIER
AS

SELECT	PCT.*
FROM	ClinicType	CT
INNER JOIN ProviderClinicType PCT
	ON	CT.Id = PCT.ClinicTypeId
INNER JOIN Provider P
	ON	PCT.ProviderId = P.Id
WHERE	NOT(@Id IS NULL AND @ProviderId IS NULL)
	AND (@Id IS NULL OR PCT.Id = @Id)
	AND (@ProviderId IS NULL OR PCT.ProviderId = @ProviderId)
	AND (@ClinicTypeId IS NULL OR PCT.ClinicTypeId = @ClinicTypeId)
					
	
RETURN @@ROWCOUNT 